package cn.com.xf.service.impl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.xf.dao.TblCheckLeaveDAO;
import cn.com.xf.domain.TblCheckLeave;
import cn.com.xf.service.LeaveService;
import cn.com.xf.web.form.LeaveForm;

@Service
public class LeaveServiceImpl implements LeaveService {

	@Autowired
	private TblCheckLeaveDAO checkLeaveDAO;
	
	@Override
	public int insertLeave(TblCheckLeave leave) {
		checkLeaveDAO.insert(leave);
		return 0;
	}

	@Override
	public List<TblCheckLeave> selectLeave(int begin, int pageSize,
			String year_month,String userid, String siteid, String deptid) {
		return checkLeaveDAO.select(begin, pageSize,year_month, userid, siteid, deptid);
	}

	@Override
	public int selectLeaveCount(String year_month,String userid, String siteid, String deptid) {
		return checkLeaveDAO.selectCount(year_month,userid, siteid, deptid);
	}

	@Override
	public int deleteLeave(Long id) {
		return checkLeaveDAO.deleteByPrimaryKey(id);
	}

	@Override
	public TblCheckLeave selectLeaveById(Long id) {
		return checkLeaveDAO.selectByPrimaryKey(id);
	}

	@Override
	public int updateLeave(TblCheckLeave leave) {
		return checkLeaveDAO.updateByPrimaryKey(leave);
	}

	@Override
	public List<TblCheckLeave> selectExport(String year_Month, String siteid, String deptid,String userid) {
		// TODO Auto-generated method stub
		return checkLeaveDAO.selectExport(year_Month, siteid, deptid,userid);
	}

	@Override
	public List<TblCheckLeave> selectPersonLeave(int begin, int pageSize, String year_month, String userid,
			String siteid, String deptid) {
		// TODO Auto-generated method stub
		return checkLeaveDAO.selectPerson(begin, pageSize, year_month, userid, siteid, deptid);
	}

	@Override
	public int selectPersonLeaveCount(String year_month, String userid, String siteid, String deptid) {
		// TODO Auto-generated method stub
		return checkLeaveDAO.selectPersonCount(year_month, userid, siteid, deptid);
	}

	@Override
	public int updateUserleave(TblCheckLeave leave) {
		// TODO Auto-generated method stub
		return checkLeaveDAO.updateByPrimaryKeySelective(leave);
	}
	

}
